let envList = {
  dev: { // 开发
    // G_HOST: 'http://192.168.0.24',
    G_HOST: 'http://101.34.114.193',
    // G_HOST: 'http://192.168.0.19',
    G_PORT: '9000',
    G_PREFIX: '',
    G_PUBLICPATH: '',
    G_IMG: 'https://www.jsck.games/shopImg/',
  },
  test: { // 测试
    G_HOST: 'http://192.168.124.15',
    // G_PORT: '9992',
    G_PORT: '9000',
    G_PREFIX: '',
    G_PUBLICPATH: '',
    G_IMG: '',
  },
  pro: { // 生产
    G_HOST: '',
    G_PORT: '',
    G_PREFIX: '',
    G_PUBLICPATH: 'center',
    G_IMG: 'https://www.jsck.games/shopImg/',
  }
}

let baseURL = ''
let url = ''
let prefix = ''
let publicPath = ''
let imgUrl = ''

// full-url
function getFullUrl (env) {
  const G_PORT = env.G_PORT ? `:${env.G_PORT}` : ''
  const G_PREFIX = env.G_PREFIX ? `/${env.G_PREFIX}` : ''
  // baseURL = env.G_HOST + G_PORT + G_PREFIX
  return env.G_HOST + G_PORT + G_PREFIX
}

// url
function getUrl (env) {
  const G_PORT = env.G_PORT ? `:${env.G_PORT}` : ''
  // url = env.G_HOST + G_PORT
  return env.G_HOST + G_PORT
}

// prefix /接口前缀
function getPrefix (env) {
  const G_PREFIX = env.G_PREFIX ? `/${env.G_PREFIX}` : '/'
  // prefix = G_PREFIX
  return G_PREFIX
}

// publicPath /公共路径
function getPublicPath (env) {
  const G_PUBLICPATH = env.G_PUBLICPATH ? `/${env.G_PUBLICPATH}` : '/'
  // publicPath = G_PUBLICPATH
  return G_PUBLICPATH
}

// imgUrl /调整imgUrl页地址
function getImg (env) {
  const G_IMG = env.G_IMG
  // imgUrl = G_IMG
  return G_IMG
}

let NODE_ENV = process.env.NODE_ENV
switch (NODE_ENV) {
case 'dev': // 开发
  baseURL = getFullUrl(envList.dev)
  url = getUrl(envList.dev)
  prefix = getPrefix(envList.dev)
  publicPath = getPublicPath(envList.dev)
  imgUrl = getImg(envList.dev)
  break
case 'test': // 测试
  baseURL = getFullUrl(envList.test)
  url = getUrl(envList.test)
  prefix = getPrefix(envList.test)
  publicPath = getPublicPath(envList.test)
  imgUrl = getImg(envList.test)
  break
case 'production': // 生产
  baseURL = getFullUrl(envList.pro)
  url = getUrl(envList.pro)
  prefix = getPrefix(envList.pro)
  publicPath = getPublicPath(envList.pro)
  imgUrl = getImg(envList.pro)
  break
}

// export default baseURL

module.exports={
  baseURL: baseURL,
  url: url,
  prefix: prefix,
  publicPath: publicPath,
  imgUrl: imgUrl
}